package 剑指offer;

/**
 * @author zhangjunfei
 * @date 2023/7/18 16:40
 */
public class O_10_02 {

    public int numWays(int n) {
        if (n == 0) {
            return 1;
        }
        int[] dp = new int[3];
        dp[0] = 0;
        dp[1] = 1;
        for (int i = 1; i <= n; i++) {
            dp[2] = (dp[0] + dp[1]) % 1000000007;
            dp[0] = dp[1];
            dp[1] = dp[2];
        }
        return dp[2];
    }
}
